package net.maku.kyy.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import net.maku.framework.mybatis.dao.BaseDao;
import net.maku.kyy.entity.KyyUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 前台用户表
 *
 * @author MAKU babamu@126.com
 * <a href="https://maku.net">MAKU</a>
 */
@Mapper
public interface KyyUserDao extends BaseDao<KyyUserEntity> {



    @Select("select forum_permission from kyy_user where id=#{userId}")
    Long selectForumPermissionById(Long userId);

    @Update("update kyy_user set last_login_ip=#{ip},last_login_time=now() where id=#{id}")
    void updateIpById(Long id, String ip);

    void updateDelStuatsByIds(List<Long> idList);

    @Select("select * from kyy_user where deleted = 1")
    IPage<KyyUserEntity> getByDeleted();
}